package com.start.cstarguardianadaptivelearningbackend.controller;

import com.start.cstarguardianadaptivelearningbackend.entity.Subject;
import com.start.cstarguardianadaptivelearningbackend.service.SubjectService;
import com.start.cstarguardianadaptivelearningbackend.vo.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/subjects")
public class SubjectController {

    private final SubjectService subjectService;

    public SubjectController(SubjectService subjectService) {
        this.subjectService = subjectService;
    }

    @GetMapping
    public Result<List<Subject>> getAllSubjects() {
        List<Subject> subjects = subjectService.getAllSubjects();
        return Result.success(subjects);
    }
}
